import { type Edge } from '@antv/x6'

export const handleEdgeAnnotation = function(edge: Edge, isOpen: boolean) {
  edge.setData({
    isOpen: isOpen
  })
  if (isOpen) {
    edge.attr('line', {
      stroke: '#1890ff',
      strokeDasharray: [20, 10],
      strokeWidth: 16,
      targetMarker: null,
      style: {
        animation: 'ant-line 30s infinite linear'
      }
    }).setZIndex(9)
  } else {
    edge.attr('line',{
      stroke: 'rgba(212,223,243,1)',
      targetMarker: null,
      strokeWidth: 16,
      strokeDasharray: null,
      style: {}
    }).removeZIndex({
      silent:true
    }).setZIndex(-99)
  }
}
